package com.chinda.common.exception;

import cn.hutool.core.exceptions.ExceptionUtil;
import cn.hutool.core.util.StrUtil;

import java.io.Serializable;

/**
 * 自定义异常
 * @author Wang Chinda
 * @date 2020/8/8
 * @see
 * @since 1.0
 */
@SuppressWarnings("AlibabaClassNamingShouldBeCamel")
public class RRException extends RuntimeException implements Serializable {
    private static final long serialVersionUID = 1L;

    public RRException(Throwable e) {
        super(ExceptionUtil.getMessage(e), e);
    }

    public RRException(String message) {
        super(message);
    }

    public RRException(String messageTemplate, Object... params) {
        super(StrUtil.format(messageTemplate, params));
    }

    public RRException(String message, Throwable throwable) {
        super(message, throwable);
    }

    public RRException(Throwable throwable, String messageTemplate, Object... params) {
        super(StrUtil.format(messageTemplate, params), throwable);
    }
}
